﻿// Decompiled with JetBrains decompiler
// Type: StoryMode.TrainingFieldEncounter
// Assembly: StoryMode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 11BAE65F-6C15-4628-A9C6-1B968588CDA1
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\Modules\StoryMode\bin\Win64_Shipping_Client\StoryMode.dll

using StoryMode.Missions;
using System.Collections.Generic;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.Encounters;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.CampaignSystem.Settlements.Locations;
using TaleWorlds.Core;

#nullable disable
namespace StoryMode
{
  public class TrainingFieldEncounter : LocationEncounter
  {
    internal static void AutoGeneratedStaticCollectObjectsTrainingFieldEncounter(
      object o,
      List<object> collectedObjects)
    {
      ((TrainingFieldEncounter) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected virtual void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
    }

    public TrainingFieldEncounter(Settlement settlement)
      : base(settlement)
    {
    }

    public override IMission CreateAndOpenMissionController(
      Location nextLocation,
      Location previousLocation = null,
      CharacterObject talkToChar = null,
      string playerSpecialSpawnTag = null)
    {
      IMission missionController = (IMission) null;
      if (nextLocation.StringId == "training_field")
      {
        int upgradeLevel = Settlement.CurrentSettlement.IsTown ? Settlement.CurrentSettlement.Town.GetWallLevel() : 1;
        missionController = (IMission) StoryModeMissions.OpenTrainingFieldMission(nextLocation.GetSceneName(upgradeLevel), nextLocation);
      }
      return missionController;
    }
  }
}
